package com.amos.generate.bean;

import com.alibaba.fastjson.JSONObject;
import com.amos.util.StringUtils;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * Copyright © 2018 嘉源锐信. All rights reserved.
 *
 * @Project: mu-exam
 * @ClassName: GenerateField
 * @Package: com.amos.generate.bean
 * @author: zhuqb
 * @Description:
 * @date: 2020/3/9 0009 下午 16:10
 * @Version: V1.0
 */
public class BaseField {
    /**
     * 包路径名称
     */
    private String packageName;
    /**
     * 大写的类名
     */
    private String upperClassName;
    /**
     * 小写的类名
     */
    private String className;

    /**
     * 作者
     */
    private String author;
    /**
     * 创建时间
     */
    private String datetime;

    /**
     * import 导入
     */
    private List<String> imports;
    /**
     * 模块名称
     */
    private String moduleName;

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getUpperClassName() {
        return upperClassName;
    }

    public void setUpperClassName(String upperClassName) {
        this.upperClassName = upperClassName;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }


    public String getAuthor() {
        if (StringUtils.isNullOrEmpty(this.author)) {
            return "Amos";
        }
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getDatetime() {
        LocalDateTime localDateTime = LocalDateTime.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return localDateTime.format(dateTimeFormatter);
    }

    public void setDatetime(String datetime) {
        this.datetime = datetime;
    }

    public List<String> getImports() {
        return imports;
    }

    public void setImports(List<String> imports) {
        this.imports = imports;
    }

    @Override
    public String toString() {
        return JSONObject.toJSONString(this);
    }

    public String getModuleName(){
        return this.moduleName;
    }
    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }

}
